home *** CD-ROM | disk | FTP | other *** search
- Path: news.delphi.com!usenet
- From: JGUILLORY@delphi.com
- Newsgroups: comp.lang.c++
- Subject: BC++ 4.52 Intel Floating Point Format
- Date: 13 Mar 1996 03:57:02 GMT
- Organization: Delphi Internet Services Corporation
- Message-ID: <4i5h2e$5rt@news2.delphi.com>
- References: <31363716.17D8@lexicon.net.au>
- NNTP-Posting-Host: bos1g.delphi.com
-
-
- Quoting LucasGiezen<lucas from a message in comp.lang.c++
- > We are developing on a PC platform and must transfer floats and doubles
- > to an IBM mainframe.
-
- MS Quick Pascal's book defines the following (which except for the 'Real'
- type, is the same as Turbo C/C++ and Microsoft C/C++ as well as the normal
- for 80x87 programming:
-
- for each below: s = sign, f = fractional part, e = exponent
- width designates width of fields below....
- bits designates the bit# of the field...
- I don't see any reference to what i and d are,
- perhaps you may be able to determine it somewhere
- else, but they are only used in EXTENDED and COMP,
- which are strictly used for 64bit and 79 bit Floating
- point numbers using a Math Coprocessor....
-
- Real:
-
- Width 1 39 8
- use s-f-------------e--
- Bits 47-----------------0
-
- Single:
-
- Width 1 8 23
- use s e-----f--------
- Bits 31---------------0
-
- Double:
-
- Width 1 11 52
- use s e-----f--------
- Bits 63---------------0
-
- Extended:
-
- Width 1 15 1 63
- use s e---i f---------
- Bits 79----------------0
-
- Comp
-
- Width 1 63
- use s d------------------
- Bits 63-------------------0
-
- All types assume that the units digit in the mantissa is equal to 1, such
- that the 4-byte single type, the value is computed as:
-
- (s) (e-127)
- -1 * 1.f*2
-
- (hard to draw the box accurately in ascii but, Bit # 47 is the sign bit,
- the lowest 8 are the exponent, and 39 bits from 9 - 46 are for the fractional
- part...
-
- > We have done a 'study' of the internal formats using debug but around
- >0 a number of strange things occur. Add to this the byte swapping of the
- > Intel chip and things really do look odd.
- > Does anyone have the format of the bits in the internal representation
- > for the PC? (We already have the mainframe format). Also the
- > representations of 0 and other oddities would be appreciated.
- > Thanks
- > Brett Walker
- > .
-
- Many mainframes, and few languages will use Binary Coded Decimal, such that
- eg: 1234.5678 would be apear in debug would look like:
-
- 12 34 56 78
-
- in other words, fixed decimal point, and each digit is stored in a nibble.
- That's about all the formats I've seen used on PC's, let me know if you
- need any more info....
-
-
- John H. Guillory
- JGuillory@Delphi.com
-
- "Tomato paste: Used to fix broken tomatoes."
-
-